How to enable `geom_text` to recognize `aes` in QPLOT (R programming)

Posted by neversaint on Stack Overflow See other posts from Stack Overflow or by neversaint
Published on 2013-06-26T02:30:53Z Indexed on 2013/06/26 4:21 UTC
Read the original article Hit count: 140

Filed under:
|
|

I have a data that looks like this

ensg mirna_hgc time value perc id
ENSG00000211521 MIR665 x 89 2.07612456747405 1
ENSG00000207787 MIR98 x 73 1.73010380622837 2
...
ENSG00000207827 MIR30A y 99 21.4532871972318 288
ENSG00000207757 MIR93 y 94 1.73010380622837 289

What I'm trying to do is to create a facet plot with label on top of it. The label can be easily called from the perc column.

Using this code:

dat.m <- read.delim("http://dpaste.com/1271039/plain/",header=TRUE,sep=" ")

qplot(value, data=dat.m,facets=time~.,binwidth=1,main="")+
xlab("Value")+ ylab("Count")+
theme(legend.position="none")+
stat_bin(aes(value,label=sprintf("%.01f",perc)),geom="text")

But it gave me this error:

Error: geom_text requires the following missing aesthetics: label

What I'm trying to do is to generate this plot: enter image description here

© Stack Overflow or respective owner

Related posts about r

    Related posts about plot